Skip to content

feat(user)!: return total count in search and searchTestUsers responses#664

Open
dorsha wants to merge 1 commit intomainfrom
feat/user-search-total-response
Open

feat(user)!: return total count in search and searchTestUsers responses#664
dorsha wants to merge 1 commit intomainfrom
feat/user-search-total-response

Conversation

@dorsha
Copy link
Member

@dorsha dorsha commented Feb 27, 2026

BREAKING CHANGE: The search and searchTestUsers methods now return UserSearchResponse with { users, total } instead of UserResponse[].

Before:

  const res = await sdk.management.user.search({...});
  res.data.forEach(user => ...);

After:

  const res = await sdk.management.user.search({...});
  console.log(res.data.total);
  res.data.users.forEach(user => ...);

Fixes #662

Must

  • Tests
  • Documentation (if applicable)

BREAKING CHANGE: The `search` and `searchTestUsers` methods now return
`UserSearchResponse` with `{ users, total }` instead of `UserResponse[]`.

Before:
  const res = await sdk.management.user.search({...});
  res.data.forEach(user => ...);

After:
  const res = await sdk.management.user.search({...});
  console.log(res.data.total);
  res.data.users.forEach(user => ...);

Closes #662

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@shuni-bot-dev
Copy link

shuni-bot-dev bot commented Feb 27, 2026

✅ Code review completed successfully

#664

Copy link

@shuni-bot-dev shuni-bot-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐕 Shuni's Review

This PR changes search and searchTestUsers to return { users, total } instead of a bare UserResponse[], exposing the total count from the API. Breaking change is clearly documented.

LGTM — no issues found. Good bones! The new UserSearchResponse type is clean, the deprecated searchAll is correctly left untouched for backward compat, tests and docs are updated consistently. Woof!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Management User SDK APIs to match the backend search response shape by returning both the matched users and the total count, addressing issue #662 and introducing a breaking response-type change for search and searchTestUsers.

Changes:

  • Change management.user.search and management.user.searchTestUsers to return { users, total } instead of UserResponse[].
  • Add UserSearchResponse type and update user management tests to validate the new response shape.
  • Update README usage examples to reflect the new response structure.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
lib/management/user.ts Changes search/searchTestUsers return types and response transformation to include total.
lib/management/user.test.ts Updates mocks and assertions to validate { users, total } responses.
lib/management/types.ts Introduces exported UserSearchResponse type.
README.md Updates examples to use data.total and data.users.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

search API returns total but the SDK does not

2 participants